<%@ page language="java" contentType="text/html; charset=UTF-8" isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="${ctx}">
<title>我的待办事务</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<link type="text/css" media="screen" charset="utf-8" rel="stylesheet" href="${ctx}/commons/css/common.css" />
<link type="text/css" media="screen" charset="utf-8" rel="stylesheet" href="${ctx}plugins/fancybox-1.3.4/jquery.fancybox-1.3.4.css" />
<script type="text/javascript" src="${ctx}plugins/jquery/jquery-1.7.min.js"></script>
<script type="text/javascript" src="${ctx}plugins/fancybox-1.3.4/jquery.mousewheel-3.0.4.pack.js"></script>
<script type="text/javascript" src="${ctx}plugins/fancybox-1.3.4/jquery.fancybox-1.3.4.pack.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		if('${login}')
			alert('${login}');
		//鼠标经过时结果行背景变色
		$(".tb-table>table tr:gt(0)").hover(function() {
			$(this).css("background", "#EEEEEE");
		}, function() {
			$(this).css("background", "");
		});
		$("#showInstance").fancybox({
			'margin'		: 0,
			'width' 		: '80%',
			'height' 		: '90%',
			'autoScale' 	: false,
			'transitionIn' 	: 'none',
			'transitionOut' : 'none',
			'type' 			: 'iframe',
		});
		$("#operationThis").fancybox({
			'margin'		: 0,
			'width' 		: '80%',
			'height' 		: '90%',
			'autoScale' 	: false,
			'transitionIn' 	: 'none',
			'transitionOut' : 'none',
			'type' 			: 'iframe',
			'onCleanup'     : function(){location.reload(true);}
		});
	});
	function showAffair(requestPath,affairNo){
		if(Boolean(requestPath) && Boolean(affairNo)){
			var obj = $("#showInstance");
			obj.attr("href",requestPath + affairNo);
			obj.trigger("click");
		}
	}
	function showInstance(instanceNo){
		if(Boolean(instanceNo)){
			var obj = $("#showInstance");
			obj.attr("href","${ctx}dispatcher.htm?action=SHOW&instanceNo=" + instanceNo);
			obj.trigger("click");
		}
	}
	function operationThis(instanceNo){
		if(Boolean(instanceNo)){
			var obj = $("#operationThis");
			obj.attr("href","${ctx}dispatcher.htm?action=OPERATION_PAGE&instanceNo=" + instanceNo);
			obj.trigger("click");
		}
	}
</script>
</head>
<body>
	<h3 class="fn-mt7" align="center">
		<span style="font-size: 14px; font-weight: bold;">等待我操办的事务</span>
		<br style="height: 0; clear: both;" />
	</h3>
	<div class="tb-table">
		<table id="tab">
			<thead>
				<tr>
					<th width="30">序 号</th>
					<th>事务编号</th>
					<th>事务类型</th>
					<th>所属流程</th>
					<th>启动时间</th>
					<th>操&emsp;作</th>
				</tr>
			</thead>
			<tbody>
				<c:choose>
					<c:when test="${fn:length(piMap) > 0}">
						<c:forEach var="pi" items="${piMap}" varStatus="str">
							<c:set var="atc" value="${fn:substringBefore(pi.key, ':') }"></c:set>
							<tr>
								<td align="center"><c:out value="${str.count}" /></td>
								<td align="center"><c:out value="${fn:substringAfter(pi.key, ':')}" /></td>
								<td align="center"><c:out value="${atMap[atc].typeName}" /></td>
								<td align="center">${ftJSON[atMap[atc].flowTypeCode]} ›› ${flowJSON[atMap[atc].flowCode] }</td>
								<td align="center"><c:out value="${pi.value}" /></td>
								<td align="center">
									<a href="javascript:showAffair('${atMap[atc].requestPath}','${fn:substringAfter(pi.key, ':')}')">事务详情</a>&emsp;
									<a href="javascript:operationThis('${pi.key}')">办理</a>&emsp;
									<a href="javascript:showInstance('${pi.key}')">办理详情</a>&emsp;
								</td>
							</tr>
						</c:forEach>
					</c:when>
					<c:otherwise>
						<tr>
							<td class="center" colspan="6">暂无记录</td>
						</tr>
					</c:otherwise>
				</c:choose>
			</tbody>
		</table>
	</div>
	<a id="showInstance" href="" style="display: none;"></a>
	<a id="operationThis" href="" style="display: none;"></a>
</body>
</html>